#ifndef ADAPTOR_SOCKET_H_
#define ADAPTOR_SOCKET_H_

#include "adaptorsocketbase.h"
#include "zmessage.h"
#include "orderlink.h"

class AdaptorServer;

class AdaptorSocket : public AdaptorSocketBase {
public:
	AdaptorSocket(OrderLink *ol, AdaptorServer *server);
	~AdaptorSocket();
	virtual void OnReceive(int nErrorCode);
	virtual void OnClose(int nErrorCode);
private:
	void mProcBuffer();
	int mProcOneMessage(char *src, int len);
private:
	static const int mBufSize = 1024;
	char		mBuffer[mBufSize];
	int			mBufLen;

	OrderLink	*mOrderLink;
	AdaptorServer	*mServer;
};

#endif //ADAPTOR_SOCKET_H_